package net.neiquan.neiquandemowithkf.utils;

import android.content.Context;

import net.neiquan.neiquandemowithkf.entity.User;


/**
 * Description
 * Author by wangHaitao(a758277560@gmail.com)
 * Created  on 2015/11/19.
 * Version 1.0
 */
public class UserUtils {
    private static final String KEY_USER = "mUser";


    public static void saveUser(Context context, User user) throws Exception {
        if (user == null) {
            SPUtils.delete(context, KEY_USER);
        } else {
            SPUtils.saveBean(KEY_USER, user);
        }
    }

    public static User getUser() throws Exception {
        return (User) SPUtils.getBean(KEY_USER, User.class);
    }
}
